package ruc.grs.ypytd.dao;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import ruc.grs.ypytd.entity.Student;
import ruc.grs.ypytd.neoutil.CommonDao;

public class StudentDao extends CommonDao<Student, Long> {
	private String SQL_GET_STUDENTS_BY_USERNAME_AND_PASSWORD = "SELECT * FROM student WHERE userName=? and password=?";
	Connection connection = null;

	public StudentDao(Connection connection) {
		super(Student.class, connection);
		this.connection = connection;
	}

	public List<Student> getStudents(String userName, String password) {
		try {
			// Object[] params = { userName, password };
			// return this.find(SQL_GET_STUDENTS_BY_USERNAME_AND_PASSWORD,
			// params);

			List<Student> students = new ArrayList<Student>();
			Student student = new Student();
			student.setUserName(userName);
			student.setPassword(password);
			System.out.println("UserName:" + userName + ", Password:"
					+ password);
			students.add(student);

			return students;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
